package com.oversea.models;

import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

@Entity
@Table(name = "course")
@org.hibernate.annotations.Entity(dynamicUpdate = true)
public class Course extends BaseModel {
	private static final long serialVersionUID = -5404056504167584942L;

	private List<Major> majorList; // 开设该课程的专业
	private String chineseName; // 课程名称中文
	private String englishName; // 课程名称英文

	@ManyToMany(cascade= {CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.LAZY)
	@JoinTable(name="course_major", joinColumns= {@JoinColumn(name="course_id")}, inverseJoinColumns= {@JoinColumn(name="major_id")})
	public List<Major> getMajorList() {
		return majorList;
	}

	public void setMajorList(List<Major> majorList) {
		this.majorList = majorList;
	}

	@Column
	public String getChineseName() {
		return chineseName;
	}

	public void setChineseName(String chineseName) {
		this.chineseName = chineseName;
	}

	@Column
	public String getEnglishName() {
		return englishName;
	}

	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}

}
